<?php
$NAME="海涛网上平价超市";
$TITLE="零食 吃货 海涛网络超市 海涛零食 海涛超市 化妆品 便宜，方便，放心的网上平价超市";

$category=-1;
if(isset($_GET['c'])){
	$category=$_GET['c'];
}

require_once('func.php');

$father=$db->get_all("select * from category where id=$category");
if(count($father)!=0 && $father[0]['father']!=0) {
	$current_id=$father[0]['father'];
}
else
	$current_id=$category;
$current='';
$other=array();
$one_level=$db->get_all("select * from category where father=0");
foreach($one_level as $value){
	if ($value['id']==$current_id){
		$value['child']=$db->get_all("select * from category where father=${value['id']}");
		$current=$value;
		continue;
	}
	$value['child']=$db->get_all("select * from category where father=${value['id']}");
	array_push($other, $value);
}
?>
<!DOCTYPE html>  
<html>  
<head>
  <Meta http-equiv="Content-Type" Content="text/html; Charset=UTF-8">
  <Meta http-equiv="Content-Language" Content="zh-CN">

  <META NAME="Title" CONTENT="零食 吃货 海涛网络超市 海涛零食 海涛超市 化妆品 便宜，方便，放心的网上平价超市">
  <META NAME="Author" CONTENT="www.haitaocs.com">
  <META NAME="Subject" CONTENT="海涛零食 海涛超市 零食 化妆品 便宜，方便，放心的网上平价超市">
  <META NAME="Description" CONTENT="提供各种时尚，可口的美味零食，以及流行美丽的化妆护理用品">
  <META NAME="Keywords" CONTENT="零食;吃货;海涛零食;海涛超市;时尚美食;美味零食;">
  <META NAME="Generator" CONTENT="零食;吃货;海涛零食;海涛超市;时尚美食;美味零食;">
  <META NAME="Language" CONTENT="zh-CN">
  <META NAME="Abstract" CONTENT="本店提供各种零食，小吃，特产以及化妆护理用品">
  <META NAME="Copyright" CONTENT="www.haitaocs.com">
  <META NAME="Designer" CONTENT="www.haitaocs.com">
  <META NAME="Publisher" CONTENT="www.haitaocs.com">
  <META NAME="Robots" CONTENT="All">  
  <title><?php echo $TITLE; ?></title> 

  <!-- mobile viewport optimisation -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <!-- stylesheets -->
  <link rel="stylesheet" href="css/styles.css" type="text/css"/>
  <link rel = "Shortcut Icon" href="favicon.ico" >  
 

  <!--[if lte IE 7]>
  <link rel="stylesheet" href="yaml/core/iehacks.min.css" type="text/css"/>
  <![endif]-->

</head>  
<body>
  <header>
    <div class="ym-wrapper">
      <div class="head-wbox">
        <div id="head" >
            <a href="http://haitaochaoshi.taobao.com/"><img src="http://img01.taobaocdn.com/imgextra/i1/135326559/T2bfkbXnFaXXXXXXXX_!!135326559.png" /></a>
			<div id="head_right">
				<form id="search" onsubmit="return false;" >
					<input type="text" class="text" name="keyword" value="输入商品关键字" onkeydown="keycheck();" onclick="$('#search .text').attr('value','')" />
					<input type="button" class="button" value="搜索商品" onmouseover="this.className='hover'" onmousedown="this.className='mousedown'" onmouseout="this.className='button'" onclick="do_search();" />
				</form>
				<div id="link" ></div>
			</div>
        </div>
      </div>
    </div>
  </header>
  <div id="nav">
      <div class="nav-wbox">
			<ul id="sddm">
				<li <?php if($category==0){echo "class=\"active\"";} ?> ><a href="?c=0" >首页</a></li>
				<?php
					if($category>0){
						$id=$current['id'];
						echo "<li class=\"active\" ><a href=\"?c=$id\" onmouseover=\"mopen('m$id')\" onmouseout=\"mclosetime()\">${current['desc']}</a>
							 <div id=\"m$id\" onmouseover=\"mcancelclosetime()\" onmouseout=\"mclosetime()\">";
					    foreach($current['child'] as $child){
							echo "<a href=\"?c=${child['id']}\"> ${child['desc']} </a>";
						}		
						echo"</div></li>";
					}
					foreach($other as $value){
						$id=$value['id'];
						echo "<li><a href=\"?c=$id\" onmouseover=\"mopen('m$id')\" onmouseout=\"mclosetime()\">${value['desc']}</a>
                             <div id=\"m$id\" onmouseover=\"mcancelclosetime()\" onmouseout=\"mclosetime()\">";
						foreach($value['child'] as $child) {
							echo "<a href=\"?c=${child['id']} \"> ${child['desc']} </a>";
						}
						echo"</div></li>";
					} 
				?>
			</ul>
			<div style="clear:both"></div>
      </div>
  </div>
  <div id="ad-top">
    <div class="ym-wrapper">
      <div class="ad-wbox">
        <div id="slides">
            <div class="slides_container">
                <div>
                    <img src="http://img04.taobaocdn.com/imgextra/i4/135326559/T2yD.dXnNaXXXXXXXX_!!135326559.jpg" width="950" height="360" />
                </div>
                <div>
                    <img src="http://img04.taobaocdn.com/imgextra/i4/135326559/T2khkeXXJbXXXXXXXX_!!135326559.jpg" width="950" height="360" />
                </div>
				<div>
                    <img src="http://img04.taobaocdn.com/imgextra/i4/135326559/T2vSOXXiRaXXXXXXXX_!!135326559.jpg" width="950" height="360" />
                </div>
				<div>
                    <img src="http://img03.taobaocdn.com/imgextra/i3/135326559/T2GQ1EXfxaXXXXXXXX_!!135326559.jpg" width="950" height="360" />
                </div>
            </div>
            <a href="#" class="prev"><img src="http://img01.taobaocdn.com/imgextra/i1/135326559/T20SwkXeNXXXXXXXXX_!!135326559.png" width="24" height="43" alt="Arrow Prev"></a>         
            <a href="#" class="next"><img src="http://img03.taobaocdn.com/imgextra/i3/135326559/T2bkZkXmxXXXXXXXXX_!!135326559.png" width="24" height="43" alt="Arrow Next"></a>
        </div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
  <div id="main">
    <div class="ym-wrapper">
      <div class="ym-wbox">
        <div id="product">
        <?php get_product($category, 0, $first_step); ?>  
			
        </div>
        <nav id="page-nav">
            <a href="getproduct.php?c=<?php echo $category;?>&page=2" style="display:none;" ></a>
        </nav> 
	<div class="clear"></div>
      </div>
    </div>
  </div>
 
  <footer>
    <div class="ym-wrapper">
      <div class="ym-wbox">
        hello
      </div>
    </div>
	<script type="text/javascript">
		var _bdhmProtocol=(("https:"==document.location.protocol)?" https://":" http://");document.write(unescape("%3Cscript src='"+_bdhmProtocol+"hm.baidu.com/h.js%3F78801593a8ba3263517390fdb526e665' type='text/javascript'%3E%3C/script%3E"));
	</script>
  </footer>
  <script type="text/javascript" src="//lib.sinaapp.com/js/jquery/2.0/jquery.min.js"></script>
  <script type="text/javascript" src="//cdn.jsdelivr.net/slidesjs/1.1.9/slides.min.jquery.js"></script>
  <script type="text/javascript" src="//cdn.jsdelivr.net/masonry/2.1.08/jquery.masonry.min.js"></script>
  <script type="text/javascript" src="js/jquery.infinitescroll.min.js"></script>
  <script type="text/javascript" src="js/jz.js"></script>
</body> 
</html>
